/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
package com.wealth.coupon.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.wealth.system.entity.Corporation;

/**
 * 优惠卷
 * @author chan
 *
 */
@Entity
@Table(name = "t_coupon")
public class Coupon implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long id;
	private String uid;
	private String name;
	private Integer infinite;			//是否限制发行量
	private Integer mode;			//优惠券批次模式 1纸质 2完善地址 3电子优惠券
	
	private Integer quantity;
	private Integer startno;
	private Integer endno;
	private Integer status;
	private String filepath;
	private String remark;
	private Date auditTime;	//审核时间
	private Date makeTime;	//制作时间
	private String creator;
	private Date createTime;
	
	private CouponRule rule;
	private Corporation corp;

	/* ---------------- method ---------------- */
	
	public Coupon() {
	}
	public Coupon(Long id) {
		this.id = id;
	}

	/* ---------------- getter/setter ---------------- */

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "uid")
	public String getUid() {
		return uid;
	}
	public void setUid(String uid) {
		this.uid = uid;
	}
	
	@Column(name = "name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "infinite")
	public Integer getInfinite() {
		return infinite;
	}
	public void setInfinite(Integer infinite) {
		this.infinite = infinite;
	}
	
	@Column(name = "quantity")
	public Integer getQuantity() {
		return quantity;
	}
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Integer getMode() {
		return mode;
	}
	public void setMode(Integer mode) {
		this.mode = mode;
	}
	@Column(name = "startno")
	public Integer getStartno() {
		return startno;
	}

	public void setStartno(Integer startno) {
		this.startno = startno;
	}

	@Column(name = "endno")
	public Integer getEndno() {
		return endno;
	}

	public void setEndno(Integer endno) {
		this.endno = endno;
	}

	@Column(name = "filepath")
	public String getFilepath() {
		return filepath;
	}

	public void setFilepath(String filepath) {
		this.filepath = filepath;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name = "audit_time")
	public Date getAuditTime() {
		return auditTime;
	}

	public void setAuditTime(Date auditTime) {
		this.auditTime = auditTime;
	}
	
	@Column(name = "make_time")
	public Date getMakeTime() {
		return makeTime;
	}

	public void setMakeTime(Date makeTime) {
		this.makeTime = makeTime;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "creator")
	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@ManyToOne
	@JoinColumn(name = "corp_id")
	public Corporation getCorp() {
		return corp;
	}

	public void setCorp(Corporation corp) {
		this.corp = corp;
	}

	@ManyToOne
	@JoinColumn(name = "rule_id")
	public CouponRule getRule() {
		return rule;
	}

	public void setRule(CouponRule rule) {
		this.rule = rule;
	}
	
	

}
